import { notFound } from "next/navigation"; import type { ReactNode } from "react"; import { api } from "@/lib/api"; /** * Existence check outside the `loading.tsx` boundary so unknown event slugs return a real 404 instead of a * 200 shell followed by the not-found UI (the page's own call is deduplicated by fetch memoization). */ export default async function EventLayout({ params, children }: { params: Promise<{ slug: string }>; children: ReactNode }) { const { slug } = await params; if (!(await api.event(slug))) notFound(); return children; }